import { TGuildAwardConfig } from "../../../Message/Db/Tables/TGuildAwardConfig";
import { StringHelper } from "../../../com/gengine/utils/StringHelper";
import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
type int = number;
//class GuildAwardConfig
    
    export  class GuildAwardConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            if (GuildAwardConfig._instance != null) 
            {
                throw new Error(" GuildAwardConfig 单例 ");
            }
            this.init();
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TGuildAwardConfig();
                loc1.level = loc2.level;
                loc1.type = loc2.type;
                loc1.value = loc2.value;
                loc1.items = StringHelper.getString(loc2.items);
                loc1.exp = loc2.exp;
                loc1.costContribute = loc2.costContribute;
                this._map[loc1.level] = loc1;
            }
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_guild_award_config.json");
            this.write(loc1);
            return;
        }

        public getConfigByLevel(arg1: int): TGuildAwardConfig
        {
            return this._map[arg1];
        }

        public static get instance(): GuildAwardConfig
        {
            if (GuildAwardConfig._instance == null) 
            {
                GuildAwardConfig._instance = new GuildAwardConfig();
            }
            return GuildAwardConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: GuildAwardConfig;
    }
